package com.itheima.controller;

import com.itheima.pojo.CheckItem;
import com.itheima.pojo.PageBean;
import com.itheima.pojo.R;
import com.itheima.service.CheckitemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RestController
@RequestMapping("/checkitem")
public class CheckitemController {
      @Autowired
      private CheckitemService checkitemService;

      @PostMapping("/findPage")
     public HashMap findPage(@RequestBody PageBean pageBean){
        return checkitemService.findPage(pageBean);
      }
      
      @PostMapping("/add")
    public R addcheckItem(@RequestBody CheckItem checkItem){
          return checkitemService.addcheckItem(checkItem);
      }

      @GetMapping("delete")
    public R deleteCheckItem(String id){
          return checkitemService.delete(id);
      }

      @GetMapping("/findById")
    public R getById( String id){
          return checkitemService.getById(id);
      }

      @PostMapping("/edit")
    public R updateById(@RequestBody CheckItem checkItem){
          return checkitemService.updateById(checkItem);
      }
}
